package com.example.demo.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.assertj.core.util.Arrays;
import org.jfree.data.general.DefaultPieDataset;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.demo.test.Student;

@Controller
public class TestController {
	
	@RequestMapping("main")
	public void main(String img,HttpServletRequest request,HttpServletResponse response,Map<String,Object> model) throws Exception{
		img = EchartsBase64Utils.imgSubString(img);
		List<Student> userList = new ArrayList<>();
		userList.add(new Student(1, "zhangsan", 18, "男", "安徽", "汉族"));
		userList.add(new Student(2, "lisi", 18, "nv", "武汉", "壮族"));
		userList.add(new Student(3, "wangwu", 19, "nv", "北京", "苗族"));
		userList.add(new Student(4, "zhaoliu", 20, "男", "上海", "回族"));
		model.put("name", "张三");
		model.put("age", 20);
		model.put("img", img);
		model.put("userList", userList);
		WordUtils.exportMillCertificateWord(request, response, model);
	}
	
	@RequestMapping("index")
	public String index(){
		return "index";
	}
	
	@RequestMapping("echart")
	public String echart(){
		return "echart";
	}
}
